using System;
using Castle.ActiveRecord;
using CosyTrade.Data;

namespace CosyTrade.Security
{
    [AddPropertyChangedNotifyInterface, PropertyChangedNotify]
    [Serializable, ActiveRecord("RoleRelation")]
    public class RoleRelation : BusinessObject
    {
        private Guid primaryKey = Guid.NewGuid();
        private Role groupRole;
        private Role childRole;

        [PrimaryKey(PrimaryKeyType.Assigned, "ROWGUID", Access=PropertyAccess.NosetterCamelcase)]
        public Guid PrimaryKey
        {
            get { return primaryKey; }
        }

        [BelongsTo(Type=typeof(Role), Column= "groupRoleGuid", NotNull=true)]
        public Role GroupRole
        {
            get { return groupRole; }
            set { groupRole = value; }
        }

        [BelongsTo(Type = typeof(Role), Column = "childRoleGuid", NotNull = true)]
        public Role ChildRole
        {
            get { return childRole; }
            set { childRole = value; }
        }
    }
}